package com.bsit.obu.model;

import com.bsit.obu.utils.MyLog;

import java.util.ArrayList;
import java.util.List;

public enum ObuStatus {
    /*
1-	正常
2-	有签挂起
3-	无签挂起
4-	有签注销
5-	无签注销
6-	标签挂失
7-	已过户
8-	维修中
*/
    NOT_ACTIVE(0, "未激活"),
    NORAL(1, "正常"),
    YOUQIANGUAQI(2, "有签挂起"),
    WUQIANGUAQI(3, "无签挂起"),
    YOUQIANZHUXIAO(4, "有签注销"),
    WUQIANZHUXIAO(11, "无签注销"),
    BIAOQIANGUASHI(12, "标签挂失"),
    GUOHU(13, "已过户"),
    WEIXIU(14, "维修中");
    private int code;
    private String content;

    ObuStatus(int code, String content) {
        this.code = code;
        this.content = content;
    }
    public static int getCode(String content){
        int code = 0;
       ObuStatus[] obuStatuses =  ObuStatus.values();
       for (int i = 0;i<obuStatuses.length;i++){
           if(obuStatuses[i].content.equals(content)){
               code =  obuStatuses[i].code;
           }
       }
       return code;
    }
    public static String getContent(int code){
        MyLog.d(MyLog.TAG,"getContent code=="+ code);
        String content = "";
        ObuStatus[] obuStatuses =  ObuStatus.values();
        for (int i = 0;i<obuStatuses.length;i++){
            if(obuStatuses[i].code==code){
                content =  obuStatuses[i].content;
            }
        }
        return content;
    }
    public static List<String> getContents(){
        List<String> list = new ArrayList<>();
        ObuStatus[] obuStatuses =  ObuStatus.values();
        for (int i = 0;i<obuStatuses.length;i++){
            list.add(obuStatuses[i].content);
        }
      return list;
    }



}
